Hello, Could someone help me on implementing and executing Trigger? My requirement is, if a "Object Text" is modified, i wanna change the value of other attribute dynamically. Please let me know the steps on how to execute and where to save as well.
Code example is appreciated.
Thank You Mansi16 - Mon Jul 04 22:29:15 EDT 2016 |
Re: Implement Trigger in DXl Hello Mansi MS. That would be an attribute pre save trigger. You will first have to write a trigger script which does what you want. In this script you can get the context your trigger is called in by getting the current Trigger, and you have some variables that you might need, e.g. Trigger t = current; AttrDef ad = attrdef(T) ; string targetValue = (value T); Object o = object(T); After your script is written, you either should deploy the script so that it is available for all users, e.g. in a network share, or you can decide to place the code directly in the "trigger" command (last parameter) Finally, for each module that you want to be surveilled, you need to install the trigger, or you can install it on project level, this needs to be done once only, unless your DXL code is contained in the trigger command, in which case you will have to re-install the trigger with every change to the code. An attribute pre save trigger on project level with a script deployed via the addins directory could be installed e.g. with the command
current = project "/asdf"
T = trigger ("unique name for my trigger", project->formal->attribute->"Object Text", pre, save, 5, "#include <../lib/triggers/myTrigger.dxl>")
But first of all, you should thoroughly read the chapter "Triggers" in the DXL manual, it should answer most of your questions. The rest can usually be found out by try-and-error.
Regards,
|
Re: Implement Trigger in DXl Mike.Scharnow - Tue Jul 05 03:18:01 EDT 2016 Hello Mansi MS. That would be an attribute pre save trigger. You will first have to write a trigger script which does what you want. In this script you can get the context your trigger is called in by getting the current Trigger, and you have some variables that you might need, e.g. Trigger t = current; AttrDef ad = attrdef(T) ; string targetValue = (value T); Object o = object(T); After your script is written, you either should deploy the script so that it is available for all users, e.g. in a network share, or you can decide to place the code directly in the "trigger" command (last parameter) Finally, for each module that you want to be surveilled, you need to install the trigger, or you can install it on project level, this needs to be done once only, unless your DXL code is contained in the trigger command, in which case you will have to re-install the trigger with every change to the code. An attribute pre save trigger on project level with a script deployed via the addins directory could be installed e.g. with the command
current = project "/asdf"
T = trigger ("unique name for my trigger", project->formal->attribute->"Object Text", pre, save, 5, "#include <../lib/triggers/myTrigger.dxl>")
But first of all, you should thoroughly read the chapter "Triggers" in the DXL manual, it should answer most of your questions. The rest can usually be found out by try-and-error.
Regards,
Hello Mike, Thank you very much. It worked.
Regards Mansi |
Re: Implement Trigger in DXl Mike.Scharnow - Tue Jul 05 03:18:01 EDT 2016 Hello Mansi MS. That would be an attribute pre save trigger. You will first have to write a trigger script which does what you want. In this script you can get the context your trigger is called in by getting the current Trigger, and you have some variables that you might need, e.g. Trigger t = current; AttrDef ad = attrdef(T) ; string targetValue = (value T); Object o = object(T); After your script is written, you either should deploy the script so that it is available for all users, e.g. in a network share, or you can decide to place the code directly in the "trigger" command (last parameter) Finally, for each module that you want to be surveilled, you need to install the trigger, or you can install it on project level, this needs to be done once only, unless your DXL code is contained in the trigger command, in which case you will have to re-install the trigger with every change to the code. An attribute pre save trigger on project level with a script deployed via the addins directory could be installed e.g. with the command
current = project "/asdf"
T = trigger ("unique name for my trigger", project->formal->attribute->"Object Text", pre, save, 5, "#include <../lib/triggers/myTrigger.dxl>")
But first of all, you should thoroughly read the chapter "Triggers" in the DXL manual, it should answer most of your questions. The rest can usually be found out by try-and-error.
Regards,
Hello Mike, I have 2 condition to be set in trigger. If "Object Text" is modified, then attribute 'X' value should change as "abc" and if "Object Text" is striked through then, attribute 'X' value (same attribute) should change as "pqr". How can I implement trigger for same attribute with 2 different conditions. How do I set trigger to change value when "Object Text" is striked thru. Could you please help.
Regards Mansi |